package experiment2;

import java.util.Arrays;

/**
 * @author mazouri
 * @create 2021-10-09 10:56
 */
public class SelectSort {
    private int[] v;

    public void sort() {
        selectSort(0);
    }

    private void selectSort(int begin) {
        if (begin == v.length) return;

        for (int j = begin + 1; j < v.length; j++) {
            if (v[begin] > v[j]) {
                int temp = v[j];
                v[j] = v[begin];
                v[begin] = temp;
            }
        }
        selectSort(begin + 1);
    }

    public static void main(String[] args) {
        SelectSort sort = new SelectSort();
        sort.v = new int[]{3, 44, 38, 5, 47,5, 15};
        sort.sort();
        System.out.println(Arrays.toString(sort.v));
    }
}
